package cn.diancan.action.api;


import com.opensymphony.xwork2.ModelDriven;
import cn.diancan.action.BaseAction;
import cn.diancan.model.types.ScoreRecordStatusType;
import cn.diancan.model.types.ScoreRecordType;
import cn.diancan.vo.ScoreRecordApiActionVo;


public class ScoreRecordAction extends BaseAction implements ModelDriven<ScoreRecordApiActionVo>{


    private static final long serialVersionUID = 362802898359226228L;
    private ScoreRecordApiActionVo requestVo = new ScoreRecordApiActionVo();
    
    

    
    
    //1.积分订单提交   -- 等待验证。
    public String uploadOrderScore(){
	try {
	    
	    
	    boolean result = scoreRecordService.saveScoreRecord(requestVo.getShopCustomerId(),requestVo.getPurchaseSaleOutOrderNumber(),requestVo.getOutRealTotalPrice(),requestVo.getRecordReMarks(),getIpAddr());
	    return jsonFormat(result,"操作成功","操作失败");
	}  catch (Exception e) { 
	    return jsonError(e);
	}
    }
    
    public String uploadScore(){ 
	try {
	    boolean result =scoreRecordService.saveScoreRecord(requestVo.getShopCustomerId(), ScoreRecordType.MANUAL.getType(), "", requestVo.getRecordReMarks(), requestVo.getUseType(),
	    	requestVo.getScoreValue(), getIpAddr(),  ScoreRecordStatusType.NOHANDLE.getType());
	    return jsonFormat(result,"操作成功","操作失败");
	}  catch (Exception e) { 
	    return jsonError(e);
	}
    }


    @Override
    public ScoreRecordApiActionVo getModel() {
	return requestVo;
    }
    
    

}
